<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:31:"../template/.\index\artice.html";i:1534517953;s:27:"../template/index/base.html";i:1534430472;}*/ ?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title><?php echo $artice['title']; ?>-<?php echo $info['webname']; ?></title>
	<meta name="keywords" content="<?php echo $info['keyword']; ?>" />
	<meta name="description" content="<?php echo $info['description']; ?>" />
	<link rel="stylesheet" href="/blog/public/static/index/layui/css/layui.css">
	<link rel="stylesheet" href="/blog/public/static/index/layui/css/global.css">
	<link rel="stylesheet" href="/blog/public/static/index/layui/css/index.css">
</head>
<script>
	window.onload = function ()
	{
		var oH2 = document.getElementById("mnavh"); 
		var oUl = document.getElementById("starlist");  
		oH2.onclick = function ()
		{
			var style = oUl.style;
			style.display = style.display == "block" ? "none" : "block";
			oH2.className = style.display == "block" ? "open" : ""
		}
	}
</script>
<body>
	<header>
		<div id="mnav">
			<div class="logo"><a href="/"><?php echo $info['webname']; ?></a></div>
			<h2 id="mnavh"><span class="navicon"></span></h2>
			<ul id="starlist">
			<?php if(is_array($nav) || $nav instanceof \think\Collection || $nav instanceof \think\Paginator): $i = 0; $__LIST__ = $nav;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$nav): $mod = ($i % 2 );++$i;?>
				<li class="layui-icon"><a href="<?php echo URL($nav['url']); ?>"><?php echo $nav['navname']; ?></a></li>
			<?php endforeach; endif; else: echo "" ;endif; if(is_array($navi) || $navi instanceof \think\Collection || $navi instanceof \think\Paginator): $i = 0; $__LIST__ = $navi;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$navi): $mod = ($i % 2 );++$i;?>
				<li class="layui-icon"><a href="<?php echo URL('/article/'.$navi['id']); ?>"><?php echo $navi['title']; ?></a></li>
			<?php endforeach; endif; else: echo "" ;endif; ?>
			</ul>
		</div>
	</header>
	<div class="notice">
		<div class="twitter"><div class=" icol"><i class="layui-icon" style="font-size: 1.2em">&#xe645;</i></div><?php echo mb_substr(strip_tags($twitter['content']),0,18,'utf-8'); ?>...</div>
	</div>
	<div class="layui-container">
	<div class="layui-row layui-col-space15">
		<!-- 内容主体区域 -->
			
			<div class="layui-col-md8"> 
				<div class="fly-panel detail-box"> 
					<div class="actitle">
						<?php echo $artice['title']; ?>
					</div> 
					<div class="auinfo"> 
						<li><i class="layui-icon"></i>
						<?php if($artice['author'] == ''): ?>
							<?php echo $user['nickname']; else: ?>
							<?php echo $artice['author']; endif; ?>
						</li> 
						<li><i class="layui-icon"></i>
						<?php echo date('Y-m-d',$artice['time']); ?>
						</li> 
						<li><i class="layui-icon"></i> <a href="../category/<?php echo $artice['cid']; ?>"><?php echo $cat['name']; ?></a></li> 
					</div> 
					<div class="detail-body photos clb"> 
						<?php echo str_replace('../../../',dirname($_SERVER['SCRIPT_NAME']),$artice['content']); ?>
					</div> 
					<div class="zaninfo"> 
						<p class="zanz"> <a href="javascript:;" onclick="aczan(<?php echo $artice['id']; ?>)">赞( <span id="ac<?php echo $artice['id']; ?>"><?php echo $artice['zan']; ?></span> )</a> </p> 
						<p class="zans"> <a href="javascript:;" onclick="good()">赞赏</a> </p> 
					</div> 
				</div> 
				<div class="layui-card"> 
					<div class="layui-card-body nextinfo"> 
						<i class="layui-icon"></i> 
						<a href="../article/<?php echo $downartice['id']; ?>"><?php echo $downartice['title']; ?></a>
						<br /> 
						<i class="layui-icon"></i> 
						<a href="../article/<?php echo $upartice['id']; ?>"><?php echo $upartice['title']; ?></a>
					</div> 
				</div> 
				<div class="fly-panel detail-box" id="flyReply"> 
					<fieldset class="layui-elem-field layui-field-title" style="text-align: center;"> 
						<legend>评论</legend> 
					</fieldset> 
					<ul class="jieda" id="jieda"> 

						<?php if(is_array($comment) || $comment instanceof \think\Collection || $comment instanceof \think\Paginator): $i = 0; $__LIST__ = $comment;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$comment): $mod = ($i % 2 );++$i;?>
						<div class="detail-about detail-about-reply"> 
							<a class="fly-avatar" href="<?php echo $comment['url']; ?>"> <img src="http://www.gravatar.com/avatar/<?php echo md5($comment['mail']); ?>?s=64" alt=" " /> </a> 
							<div class="fly-detail-user"> 
								<a href="<?php echo $comment['url']; ?>" class="fly-link"><cite><?php echo $comment['name']; ?></cite> </a> 
							</div> 
							<div class="detail-hits"> 
								<span><?php echo date('Y-m-d H:i:s',$comment['time']); ?></span> 
							</div> 
						</div> 
						<div class="detail-body jieda-body photos"> 
							<p><?php echo $comment['text']; ?></p> 
						</div> 
						<div class="jieda-reply"> 
							<span type="reply"> 
								<div class="jieda-admin" onclick="atAdd('<?php echo $comment['uid']; ?>','<?php echo $comment['name']; ?>')"> 
									<a href="#tjpl" class="hui"> <i class="iconfont icon-svgmoban53"></i> 回复</a>  
								</div> </span>
							</div>  
						<?php endforeach; endif; else: echo "" ;endif; if(empty($comment) || (($comment instanceof \think\Collection || $comment instanceof \think\Paginator ) && $comment->isEmpty())): ?>
								<li class="fly-none">消灭零回复</li>
								<?php endif; ?>
								<li class="fly-none" id="tjpl"></li> 
							</ul> 
							<div class="layui-form layui-form-pane"> 
								<form> 
								<?php echo token(); ?>
								<input type="hidden" name="id" value="<?php echo $artice['id']; ?>">
								<input type="hidden" id="com_id" name="com_id">
									<div class="layui-form-item"> 
										<label class="layui-form-label">昵称</label> 
										<div class="layui-input-block"> 
											<input type="text" name="name"  lay-verify="required" placeholder="请输入你的昵称" autocomplete="off" class="layui-input" value="<?php echo cookie('visitorname'); ?>" /> 
										</div> 
									</div> 
									<div class="layui-form-item"> 
										<label class="layui-form-label">网址</label> 
										<div class="layui-input-block"> 
											<input type="text" name="url" lay-verify="url" placeholder="请输入你的网址" autocomplete="off" class="layui-input" value="<?php echo cookie('visitorurl'); ?>" /> 
										</div> 
									</div> 
									<div class="layui-form-item"> 
										<label class="layui-form-label">邮箱</label> 
										<div class="layui-input-block"> 
											<input type="text" name="email" lay-verify="email" placeholder="请输入你的邮箱" autocomplete="off" class="layui-input" value="<?php echo cookie('visitoremail'); ?>" /> 
										</div> 
										<input type="checkbox" name="onemail" title="有人回复时邮件通知我" lay-skin="primary" /> 
									</div> 
									<div class="layui-form-item layui-form-text"> 
										<a name="comment"></a> 
										<div class="layui-input-block"> 
											<textarea id="L_content" name="content" placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 80px;"></textarea> 
										</div> 
									</div> 
									<div class="layui-form-item"> 
										<button class="layui-btn fr" lay-filter="reply" lay-submit="submit" id="sendreply">提交回复</button> 
									</div> 
								</form> 
							</div> 
						</div> 
					</div> 

			<div class="layui-col-md4">
				<div class="fly-panel txtcen">
					<h3 class="fly-panel-title meinfo">关于我</h3>
					<div class="blog-face"><img src="/blog/public/static/index/images/face.png"></div>
					<div class="userinfo">
						<li>网名:<?php echo $user['nickname']; ?></li>
						<li>签名:<?php echo $user['autograph']; ?></li>
						<li>邮箱:<?php echo $user['email']; ?></li>
					</div>
				</div>


				<div class="fly-panel fly-signin">
					<div class="fly-panel-main fly-signin-main">
						<form action="<?php echo URL('/search'); ?>" method="post">
							<?php echo token(); ?>
							<input type="text" name="key" required lay-verify="required" placeholder="发现更多" class="layui-input search-txt"><button class="layui-btn search-but">搜索</button>
						</form>
					</div>
				</div>

				<div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
					<h3 class="fly-panel-title toparticle"><i class="layui-icon ico">&#xe609;</i>推荐文章</h3>
					<div class="tuijian">
						<ul>
							<?php if(is_array($topartice) || $topartice instanceof \think\Collection || $topartice instanceof \think\Paginator): $i = 0; $__LIST__ = $topartice;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$topartice): $mod = ($i % 2 );++$i;?>
							<li><a href="<?php echo URL('/article/'.$topartice['id']); ?>"><?php echo $topartice['title']; ?></a></li>
							<?php endforeach; endif; else: echo "" ;endif; ?>
						</ul>
					</div>
				</div>
				<div class="fly-panel fly-link">
					<h3 class="fly-panel-title toparticle"><i class="layui-icon ico">&#xe600;</i>文章分类</h3>
					<dl class="fly-panel-main">
						<?php if(is_array($category) || $category instanceof \think\Collection || $category instanceof \think\Paginator): $i = 0; $__LIST__ = $category;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$category): $mod = ($i % 2 );++$i;?>
						<dd><a href="<?php echo URL('/category/'.$category['id']); ?>"><?php echo $category['name']; ?></a><dd>
						<?php endforeach; endif; else: echo "" ;endif; ?>
					</dl>
				</div>

				<div class="fly-panel">
					<div class="fly-panel-title toparticle">
						<i class="layui-icon ico">&#xe735;</i>支持我们
					</div>
					<div class="fly-panel-main">
						<a href="" target="_blank" class="fly-zanzhu" style="background-color: #5FB878;">可以放广告</a>
					</div>
				</div>

				<div class="fly-panel fly-link">
					<h3 class="fly-panel-title toparticle"><i class="layui-icon ico">&#xe64d;</i>友情链接</h3>
					<dl class="fly-panel-main">
						<?php if(is_array($link) || $link instanceof \think\Collection || $link instanceof \think\Paginator): $i = 0; $__LIST__ = $link;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$link): $mod = ($i % 2 );++$i;?>
						<dd><a href="<?php echo $link['url']; ?>" target="_blank"><?php echo $link['name']; ?></a><dd>
						<?php endforeach; endif; else: echo "" ;endif; ?>
						<dd><a href="<?php echo URL('/links'); ?>" class="fly-link">申请友链</a><dd>
					</dl>
				</div>
</div>
	</div>
	<div class="fly-footer">
		<p><a href="http://warss.cn/" target="_blank">Xiele-淡墨</a> 2018 &copy;<?php echo $info['kor']; ?>
		<p><a href="javascript:;" onclick="good()">捐助赞赏</a><?php echo $info['bottom']; ?>
	</div>
<script src="/blog/public/static/index/layui/layui.js"></script>

<script type="text/javascript">
function atAdd(replyerid,username){
	layui.use(['jquery','form','layedit'],function(){
		var layedit = layui.layedit;
		var form = layui.form; 
		var $ = layui.$;
		var name = username;
		$('#com_id').val(replyerid);
		$('#L_content').val('@'+name+' ,');
		index = layedit.build('L_content', {
			height: 180,
			tool: ['face']
  		}); //渲染编辑器
	});
}
//点赞
function aczan(acid){
	layui.use('jquery',function(){
		var $ = layui.$;
		zan = $('#ac'+acid).html();
		if (checkcookie(acid) == true) {
		$.ajax({
		type:"POST",
		url:"../zan",
		dataType:"json",
		data: {id:acid},
		error: function (XmlHttpRequest, textStatus, errorThrown) {
			if (XmlHttpRequest.responseText != "") {
				layer.closeAll('loading');
				layer.msg('点赞失败，请稍后尝试！');
			}
		},
		success:function(data){
            if (data.result == "1") {
            	layer.closeAll('loading');
            	$('#ac'+acid).html(parseInt(zan)+1);
            	layer.msg('点赞成功');
            }
        }
    });
		}else{
			layer.msg('你已经点过赞了');
		}
	});
}

function checkcookie(gindex){
	var thiscookie = 'acid' + gindex;
	var mapcookie = getCookie(thiscookie)
	if (mapcookie!=null && mapcookie!=""){
		return false;
	}else {
		setCookie('acid'+gindex,'ac'+gindex);
		return true;
	} 
}

function getCookie(c_name){
	 if (document.cookie.length > 0){
		 c_start = document.cookie.indexOf(c_name + "=");
		 if (c_start != -1){
			 c_start = c_start + c_name.length + 1 ;
			 c_end = document.cookie.indexOf(";" , c_start);
			 if (c_end == -1) {
				  c_end = document.cookie.length;
			 }
			 return unescape(document.cookie.substring(c_start , c_end));
		 } 
	 }
	 return "";
 }

function setCookie(name,value) 
{ 
	var Days = 30; 
	var exp = new Date(); 
	exp.setTime(exp.getTime() + Days*24*60*60*3600); 
	document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); 
} 

layui.use(['layer', 'form', 'element'], function(){
	var layer = layui.layer
	,form = layui.form;
});
function good(){
	layer.open({
		title:'赞赏',
		type: 1,
  	area: ['300px', '443px'], //宽高
  	content: '<img src="./layui/images/good.png">'
  });
}
layui.use('util', function(){
	var util = layui.util;
	util.fixbar({
		bgcolor:'#333',
		bar1: true
		,click: function(type){
			if(type === 'bar1'){
				layer.msg('分享美好时光')
			}
		}
	});
});
layui.use(['layedit','jquery','form'], function(){
	var layedit = layui.layedit;
	form = layui.form;
	var $ = layui.$;
	var index = layedit.build('L_content', {
		tool: ['face'],
		height: 180
  }); //建立编辑器

$("#sendreply").click(function(){
//同步编辑器内容
layedit.sync(index);
form.on('submit(reply)', function(data){
	$.ajax({
		type:"POST",
		url:'../reply',
		dataType:"json",
		data: data.field,
		beforeSend: function () {
			$("#sendreply").attr({"disabled":"disabled"});
			$("#sendreply").addClass("layui-btn-disabled");
			$("#sendreply").html("正在回复中...");
			layer.load(1);
		},
		error: function (XmlHttpRequest, textStatus, errorThrown) {
			if (XmlHttpRequest.responseText != "") {
				layer.closeAll('loading');
				layer.msg('提交失败，请稍后尝试！');
				$("#sendreply").removeClass("layui-btn-disabled");
				$("#sendreply").removeAttr("disabled");  
				$("#sendreply").html("提交回复");
			}
		},
		success:function(data){
            if (data.result == "1") {
            	layer.msg(data.msg);
            	layer.closeAll('loading');
            	$("#sendreply").removeClass("layui-btn-disabled");
            	$("#sendreply").removeAttr("disabled");  
            	$("#sendreply").html("提交回复");
            	setTimeout(function(){
            		location.reload();
            	},1000);
            }else if(data.result = "2"){
            	layer.closeAll('loading');
            	layer.msg(data.msg);
            	$("#sendreply").removeClass("layui-btn-disabled");
            	$("#sendreply").removeAttr("disabled");  
            	$("#sendreply").html("提交回复");

            }
        }
    });
	return false;
});
});
});
</script>

<script>
layui.use(['layer', 'form', 'element'], function(){
	var layer = layui.layer
	,form = layui.form;
});
layui.use('util', function(){
	var util = layui.util;

  //执行
  util.fixbar({
  	bgcolor:'#333',
  	bar1: true
  	,click: function(type){
  		if(type === 'bar1'){
  			layer.msg('分享美好时光')
  		}
  	}
  });
});
function good(){
	layer.open({
		title:'赞赏',
		type: 1,
  	area: ['300px', '443px'], //宽高
  	content: '<img src="/blog/public/static/index/images/good.png">'
  });
}
</script> 
</body>
</html>
